package com.airconditioner.sales.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.airconditioner.sales.R;

/**
 * 作者：shuizi_wade on 2017/2/7
 * 邮箱：674618016@qq.com
 */

public class GatherCalculateAdapter extends BaseAdapter {
    private Context context;

    public GatherCalculateAdapter(Context context) {
        this.context = context;
    }

    @Override
    public int getCount() {
        return 4;
    }

    @Override
    public Object getItem(int position) {
        return null;
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder holder;
        if (convertView == null) {
            convertView = LayoutInflater.from(context).inflate(R.layout.activity_gather_calculate_list_row, null);
            holder = new ViewHolder();
            holder.tv_genre = (TextView) convertView.findViewById(R.id.gather_calculate_tv_genre);
            holder.tv_model = (TextView) convertView.findViewById(R.id.gather_calculate_tv_model);
            holder.tv_money = (TextView) convertView.findViewById(R.id.gather_calculate_tv_money);
            holder.relat_gather_calculate_list_row = (RelativeLayout) convertView.findViewById(R.id.relat_gather_calculate_list_row);
            convertView.setTag(holder);
        } else {
            holder = (ViewHolder) convertView.getTag();
        }
        if (position % 2 == 0)
            holder.relat_gather_calculate_list_row.setBackgroundColor(context.getResources().getColor(R.color.white_color));
        else
            holder.relat_gather_calculate_list_row.setBackgroundColor(context.getResources().getColor(R.color.home_marquee_color));
        return convertView;
    }

    class ViewHolder {
        public TextView tv_genre;
        public TextView tv_model;
        public TextView tv_money;
        public RelativeLayout relat_gather_calculate_list_row;
    }
}
